package xyz.ddlnt.serviceusrclient.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.LoginDTO;
import xyz.ddlnt.model.dto.UserInfoDTO;
import xyz.ddlnt.model.entity.UserInfo;
import xyz.ddlnt.model.vo.BloggerInfoVO;
import xyz.ddlnt.model.vo.UserAchieveVO;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/6 22:55
 */
//@FeignClient(name = "service-usr", url = "http://yixuewang-service-usr:9015", path = "/user")
//@FeignClient(name = "service-usr", url = "http://localhost:9005", path = "/user")
@FeignClient(value = "service-usr", path = "/user")
public interface UserFeignClient {
    /**
     * 用户登录
     * @param loginDTO
     * @return
     */
    @PostMapping("/login")
    Result<String> login(@RequestBody LoginDTO loginDTO);

    /**
     * 用户注册
     * @param loginDTO
     * @return
     */
    @PostMapping("/register")
    Result<Boolean> register(@RequestBody LoginDTO loginDTO);

    /**
     * 用户注销
     * @param loginDTO
     * @return
     */
    @PostMapping("/cancel")
    Result<Boolean> cancel(@RequestBody LoginDTO loginDTO);

    /**
     * 获取用户信息
     * @param id
     * @return
     */
    @GetMapping("/getUserInfo")
    Result<UserInfo> getUserInfo(@RequestParam Long id);

    /**
     * 修改用户信息
     * @param userInfoDTO
     * @return
     */
    @PostMapping("/updateUserInfoById")
    Result<Boolean> updateUserInfoById(@RequestBody UserInfoDTO userInfoDTO);

    /**
     * 获取博主信息
     * @param id
     * @return
     */
    @GetMapping("/getBloggerInfo")
    Result<UserInfo> getBloggerInfo(@RequestParam Long id);

    /**
     * 获取文章的博主信息
     * @param id
     * @return
     */
    @GetMapping("/getPostBloggerInfo")
    Result<BloggerInfoVO> getPostBloggerInfo(@RequestParam Long id);

    /**
     * 获取用户成就信息
     * @param id
     * @return
     */
    @GetMapping("/getUserAchieve")
    Result<UserAchieveVO> getUserAchieve(@RequestParam Long id);
}
